home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
130 MIDI Tool Box
/
130 MIDI Tool Box.iso
/
mpu401c
/
record.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-11-02
|
1KB
|
60 lines
/* Copyright (C) 1986 by M. J. Shannon, Jr.
** Permission to distribute for non-commercial uses granted as long as this
** notice is retained. Violators will be prosecuted.
*/
#include <stdio.h>
#include "mpu/mpu.h"
unsigned char read_buf[5120]; /* a buffer to read into */
int
main(argc, argv, envp)
int argc;
char **argv;
char **envp;
{
char *vers_string;
setbuf(stdout, NULL);
/* reset the MPU */
mpu_reset();
/* get the firmware version/revision */
vers_string = mpu_id();
/* show it to the user */
printf("MPU: %s\n", vers_string);
/* enable various options */
mpu_put(SWE_HEXCL);
mpu_put(SWE_DATAINSTOP);
mpu_put(SWE_TIME);
mpu_put(SWE_MODE);
mpu_put(SWE_BENDER);
mpu_put(SWE_MEASEND);
mpu_put(SWE_COMMON);
mpu_put(SWE_REALTIME);
if (argc > 1)
mpu_put(0x22);
/* and get packets until the user gives up */
for (;;)
{
int length, i;
unsigned char c;
length = mpu_read(&read_buf[0]);
if (length)
{
printf("Length = %d:\n", length);
for (i = 0; i < length; ++i)
{
c = read_buf[i];
printf("%x%x ", (c >> 4) & 0x0F, c & 0x0F);
}
printf("\n");
}
else
printf(" \b \b \b");
}
/* return success to DOS */
return (0);
}